﻿using TriangleGames.TrainRes;
using System;
using System.Collections.Generic;
using UnityEngine;

public class TrainResGlobalsCore : ScriptableObject
{
    [SerializeField]
    private List<string> events = new List<string>();
    private static TrainResGlobalsCore instance;
    [SerializeField]
    private FsmVariables variables = new FsmVariables();

    public static void ResetInstance()
    {
        instance = null;
    }

    public List<string> Events
    {
        get
        {
            return this.events;
        }
        set
        {
            this.events = value;
        }
    }

    public static TrainResGlobalsCore Instance
    {
        get
        {
            if (instance == null)
            {
                UnityEngine.Object obj2 = Resources.Load("TrainResGlobals", typeof(TrainResGlobalsCore));
                if (obj2 != null)
                {
                    TrainResGlobalsCore globals = (TrainResGlobalsCore) obj2;
                    instance = ScriptableObject.CreateInstance<TrainResGlobalsCore>();
                    instance.Variables = globals.variables;
                    instance.Events = globals.Events;
                }
                else
                {
                    instance = ScriptableObject.CreateInstance("TrainResGlobals") as TrainResGlobalsCore;
                }
            }
            return instance;
        }
    }

    public FsmVariables Variables
    {
        get
        {
            return this.variables;
        }
        set
        {
            this.variables = value;
        }
    }
}

